package com.swancloud.model.compute;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.swancloud.common.Buildable;
import com.swancloud.model.ModelEntity;
import com.swancloud.model.compute.builder.VersionBuilder;

import java.util.List;
import java.util.Map;

/**
 * Endpoint model for identity v3.
 *
 * URL: https://docs.openstack.org/api-ref/compute/?expanded=force-migration-complete-action-force-complete-action-detail,list-all-major-versions-detail#api-versions
 */
public interface Version extends ModelEntity, Buildable<VersionBuilder> {

    public enum Status {
        CURRENT,
        SUPPORTED,
        DEPRECATED;

        @JsonCreator
        public static Status forValue(String value) {
            if (value != null) {
                for (Status s : Status.values()) {
                    if (s.name().equalsIgnoreCase(value))
                        return s;
                }
            }
            return Status.CURRENT;
        }
    }
    /**
     * A common name for the version in question. Informative only, it has no real semantic meaning.
     *
     * @return the Id of the endpoint
     */
    String getId();
    /**
     * @return the Links of the endpoint
     */
    List<Map<String, String>> getLinks();

    /**
     * @return the Links of the endpoint
     */
    List<Map<String, String>> getMediaTypes();

    /**
     * @return If this version of the API supports microversions, the minimum microversion that is supported. This will be the empty string if microversions are not supported.
     */
    String getMinVersion();

    String getMaxVersion();

    /**
     * The status of this API version. This can be one of:
     *
     * CURRENT: this is the preferred version of the API to use
     *
     * SUPPORTED: this is an older, but still supported version of the API
     *
     * DEPRECATED: a deprecated version of the API that is slated for removal
     */
    Status getStatus();

    /**
     * @return This is a fixed string. It is 2011-01-21T11:33:21Z in version 2.0, 2013-07-23T11:33:21Z in version 2.1
     */
    String getUpdated();

    /**
     * @return If this version of the API supports microversions, the maximum microversion that is supported. This will be the empty string if microversions are not supported.
     */
    String getVersion();

}
